Skip to content

fix: add ConfigureAwait(false) throughout async code to prevent synchronization context deadlocks#30

Merged
josiasmontag merged 2 commits intocloudconvert:masterfrom
Banovvv:fixes-and-improvements
Mar 13, 2026
Merged

fix: add ConfigureAwait(false) throughout async code to prevent synchronization context deadlocks#30
josiasmontag merged 2 commits intocloudconvert:masterfrom
Banovvv:fixes-and-improvements

Conversation

@Banovvv
Copy link
Contributor

@Banovvv Banovvv commented Mar 13, 2026

Problem

Users calling any async method on CloudConvertAPI (CreateJobAsync(), UploadAsync(), WaitJobAsync(), etc.) in environments with a synchronization context (ASP.NET classic, WinForms, WPF) would experience a deadlock if the call chain blocked anywhere with .Result or .Wait().

Fix

  • Added ConfigureAwait(false) to every await call in WebApiHandler and RestHelper, so continuations resume on any available thread pool thread rather than the captured synchronization context.
  • Additionally, I refactored RestHelper.RequestAsync<T>() to short-circuit on HTTP 204 NoContent before attempting to read the response body, avoiding an unnecessary ReadAsStringAsync() call.

Fixes: #14

References

@josiasmontag josiasmontag merged commit af2ad2b into cloudconvert:master Mar 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CreateJobAsync No Response

2 participants